﻿using System;
using System.Collections.Generic;
using NetBay.Core.BusinessEntities;
using System.Data;

namespace Rio.Manager.Business.Repository.Translator
{
    public class NumerizationFoldersByDateTranslator
    {
        public static List<NumerizationFoldersByDate> GetNumerizationFoldersByDate(IDataReader P_oDbDataReader)
        {
            var numerizationFoldersByDateList = new List<NumerizationFoldersByDate>();
            try
            {
                using (P_oDbDataReader)
                {
                    while (P_oDbDataReader.Read())
                    {
                        numerizationFoldersByDateList.Add(new NumerizationFoldersByDate()
                                                          {
                                                              Date = DateTime.Parse(P_oDbDataReader["SCAN_DATE"].ToString()),
                                                              NbFoldersProcessed = Int32.Parse(P_oDbDataReader["NB_TREATED_FOLDER"].ToString()),
                                                          });
                    }
                }
            }
            catch (Exception ex)
            {
                NetBay.Core.Log.LogManager.Instance().LogError("EXCEPTION -> " + Environment.NewLine + ex);
            }
            return numerizationFoldersByDateList;
        }
    }
}